package com.gln.bloger.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.gln.bloger.exception.BlogerException;

/**
 * base  manager
 * @author renxj
 *
 */
public interface BaseDao <T> {
	/**
	 * save or update specified entity
	 * @param t
	 * @throws BlogerException
	 */
	public void saveOrUpdate(T t) throws BlogerException;
	
	/**
	 * remove specified entity
	 * @param t
	 * @throws BlogerException
	 */
	public void remove(T t) throws BlogerException;
	
	/**
	 * get by criteria
	 * @param detachedCriteria
	 * @return
	 * @throws BlogerException
	 */
	public List<T> getListByCriteria(DetachedCriteria detachedCriteria)
	                                 throws BlogerException;
	/**
	 * get entity by id
	 * @param id
	 * @return
	 * @throws BlogerException
	 */
	public T get(String id) throws BlogerException;
	/**
	 * load entity by id
	 * @param id
	 * @return
	 * @throws BlogerException
	 */
	public T load(String id) throws BlogerException;
	/**
	 * get entity by entity name
	 * @return
	 * @throws BlogerException
	 */
	public T getByName(String name) throws BlogerException;
	/**
	 * list all
	 * @return
	 * @throws BlogerException
	 */
	public List<T> list() throws BlogerException;
}
